﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SoliderStateMove : NState<SlgEntitySoldier>
{
    public void Enter(SlgEntitySoldier entity, params object[] args)
    {
        Vector3 dir = (Vector3)args[0];
        entity.PlayAction(SlgFightDef.c_sAction_Move, true);
        entity.m_pMoveComp.m_fMaxSpeed = SlgFightDef.FChangeSpeedMax;
        entity.m_pMoveComp.AccelerationMoveDir(UnityEngine.Random.Range(SlgFightDef.FChargeAccMin, SlgFightDef.FChargeAccMax), dir);
        entity.m_pGameObj.transform.forward = dir;

        BattleEffectMgr.Instance.CreateEffectObj(11002, entity.Id, entity.m_pGameObj.transform, new Vector3(0, 0, -0.2f), new Vector3(0,90,0));
    }

    public void Execute(SlgEntitySoldier entity, params object[] args)
    {

    }

    public void Exit(SlgEntitySoldier entity, params object[] args)
    {
        BattleEffectMgr.Instance.DelEntityAllEffObj(entity.Id);
    }

    public bool OnMessage(SlgEntitySoldier entity, MessageBody message)
    {
        return false;
    }
}
